<template>
  <div>
     <Form
        :model="modelForm"
        class="ivu-form-no-margin-bottom"
        ref="editForm"
        :rules="rule"
        :label-width="170"
      >

        <Form-item prop="tableCode"  label="业务单元：">
          <Select size="small" filterable v-model="modelForm.tableCode" >
            <Option
              v-for="(item, index) in bussinessUnit"
              :value="item.trgNode"
              :key="`${item.trgNode}${index}`"
              >{{ item.trgNode }}</Option
            >
          </Select>
        </Form-item>
      </Form>
  </div>
</template>

<script>
export default {
  name: 'downLoadFile',
  props:{
    'bussinessUnit': {
      type: Array,
      default: () => []
    }
  },
  data() {
    return {
      modelForm: {
        tableCode: '',
      },

      rule: {
        tableCode: [{ required: true, message: '请选择业务单元', trigger: 'blur' }],
      }
    }
  },
  created: function() {
    this.$emit("SetTitle", "下载模板");
    this.$emit("SetPageWidth", 700);
    this.$emit("SetPageMinHeight", 100);
     this.$emit("SetScroll", 'inherit');
    
    this.$emit("SetPageActions", [

      {
        text: '确定',
        theme: "primary",
        handle: () => {
           this.$refs['editForm'].validate(valid => {
            if (valid) {
              this.$emit("Close", this.modelForm.tableCode);
            }
           })
        }
      },
      {
        text: '取消',
        theme: "primary",
        handle: () => {
          this.$emit("Close");
        }
      },
    ]);
  },
}
</script>
